<?php 
	defined('IN_ADMIN') or exit('No permission resources.');
	include $this->admin_tpl('header', 'admin');
	$pc_hash = $_SESSION['pc_hash'];
?>
<div class="pad-10">
  <div class="common-form">
    <fieldset>
    <legend>日志分析</legend>
    <div class="bk15"></div>
    <table cellpadding="0" cellspacing="0" class="table_list" width="100%">
      <tr>
        <th>任务名称</th>
        <th width="120" align="center">首次运行</th>
        <th width="120">末次运行</th>
        <th width="60">运行次数</th>
        <th width="60">成功次数</th>
        <th width="60">暂停次数</th>
        <th>运行时间总计</th>
        <th>分析结果</th>
        <th width="200">清理日志</th>
      </tr>
      <tr>
        <td width="100" style="text-align: center"><? echo $taskname;?> </td>
        <td style="text-align: center"><? if($begtime) {echo date( 'Y-m-d H:i:s', $begtime );}else{echo '未执行';}?> </td>
        <td style="text-align: center"><? if($endtime) {echo date( 'Y-m-d H:i:s', $endtime );}else{echo '未执行';}?></td>
        <td style="text-align: center"><? echo $runtimes;?> </td>
        <td style="text-align: center"><? echo $runok;?> </td>
        <td style="text-align: center"><? echo $runerr;?> </td>
        <td style="text-align: center"><?
	$rday = floor ( $alltime / (60 * 60 * 24) );
	$rhour = floor ( $alltime / (60 * 60) );
	$rmin = floor ( ($alltime / 60) % 60 );
	echo $rday . " 天 " . $rhour . " 小时 " . $rmin . " 分钟 ";
	?>
        </td>
        <td style="text-align: center">
		<? if ($counttime > 0) {?>
          <font color="#FF0000">任务好像意外结束了<BR />最后一次执行任务已经距现在<? echo $countmin;?>分钟</font>
        <? } else {?>
          <font color="#009933">任务执行顺利</font>
        <? }?>
        </td>
        <td style="text-align: center"><?
	$all = time ();
	$day = $all - 86400;
	$sday = $all - 86400 * 3;
	$week = $all - 86400 * 7;
	$mth = $all - 86400 * 30;
	?>
  <a href="javascript:confirmurl('?m=tasks&c=tasks&a=logdel&logtaskid=<? echo $logtaskid;?>&deltype=<?=$all?>', '删除所有日志，确定删除？')">全部</a> 
  <a href="javascript:confirmurl('?m=tasks&c=tasks&a=logdel&logtaskid=<? echo $logtaskid;?>&deltype=<?=$day?>', '删除一天前所有日志，确定删除？')">一天前</a> 
  <a href="javascript:confirmurl('?m=tasks&c=tasks&a=logdel&logtaskid=<? echo $logtaskid;?>&deltype=<?=$sday?>', '删除三天前所有日志，确定删除？')">三天前</a> 
  <a href="javascript:confirmurl('?m=tasks&c=tasks&a=logdel&logtaskid=<? echo $logtaskid;?>&deltype=<?=$week?>', '删除一周前所有日志，确定删除？')">一周前</a> 
  <a href="javascript:confirmurl('?m=tasks&c=tasks&a=logdel&logtaskid=<? echo $logtaskid;?>&deltype=<?=$mth?>', '删除一月前所有日志，确定删除？')">一月前</a>
      </tr>
    </table>
    </fieldset>
    <fieldset>
    <legend>详细日志</legend>
    <div class="bk15"></div>
    <table cellpadding="0" cellspacing="1" class="table_list" width="100%">
      <tr>
        <th style="width: 10%">日志ID</th>
        <th style="width: 10%">任务ID</th>
        <th>任务类型</th>
        <th>日志大小</th>
        <th>日志说明</th>
        <th>日志时间</th>
      </tr>
<?
if (is_array ( $tasks ))
	foreach ( $tasks as $task ) {
?>
      <tr height="22px;">
        <td style="text-align: center"><? echo $task['logid']; ?></td>
        <td style="text-align: center"><? echo $task['logtaskid']; ?></td>
        <td style="text-align: center"><? echo seltasktypes($task['logtaskid']); ?></td>
        <td style="text-align: center"><? echo $task['logsize']; ?></td>
        <td style="text-align: center"><? echo $task['loginfo']; ?></td>
        <td style="text-align: center"><? echo date( "Y-m-d H:i:s", $task ['logtime'] ); ?></td>
      </tr>
<?
	}
?>
    </table>
    <div id="pages"><?php echo $pages?></div>
    </fieldset>
  </div>
</div>
</body></html>